<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta http-equiv="Content-Style-Type" content="text/css">
<link rel="up" title="TJpgDec" href="../00index.html">
<link rel="stylesheet" href="../css_e.css" type="text/css" media="screen" title="ELM Default">
<title>TJpgDec - jd_decomp</title>
</head>

<body>

<div class="para func">
<h2>jd_decomp</h2>
<p>The jd_decomp function decompress the JPEG image and output it as RGB data.</p>
<pre>
JRESULT jd_decomp (
  JDEC* <em>jdec</em>,             <span class="c">/* Pointer to valid decompressor object */</span>
  int(*<em>outfunc</em>)(JDEC*,void*,JRECT*), <span class="c">/* Pointer to output function */</span>
  uint8_t <em>scale</em>           <span class="c">/* Scaling factor */</span>
);
</pre>
</div>

<div class="para arg">
<h4>Parameters</h4>
<dl class="par">
<dt>jdec</dt>
<dd>Specifies the valid decompressor object.</dd>
<dt>outfunc</dt>
<dd>Specifies the user defined <a href="output.html">data output function</a>. The jd_decomp function calls this function to output the decompressed JPEG image in RGB form.</dd>
<dt>scale</dt>
<dd>Specifies scaling factor N for output. The output image is descaled to 1 / 2 ^ N (N = 0 to 3). When scaling feature is disabled (<tt>JD_USE_SCALE == 0</tt>), it must be 0.</dd>
</dl>
</div>


<div class="para ret">
<h4>Return Values</h4>
<dl class="ret">
<dt>JDR_OK</dt>
<dd>Function succeeded.</dd>
<dt>JDR_INTR</dt>
<dd>The decompression process is interrupted by output function.</dd>
<dt>JDR_INP</dt>
<dd>An error occured in input function due to hard error or wrong stream termination.</dd>
<dt>JDR_PAR</dt>
<dd>Parameter error. Given scale factor is invalid.</dd>
<dt>JDR_FMT1</dt>
<dd>Data format error. The JPEG data can be collapted.</dd>
</dl>
</div>


<div class="para desc">
<h4>Description</h4>
<p>The jd_decomp is the second stage of a JPEG decompression session. It decompresses the JPEG image and outputs it via user defined output function. After this function, the decompressor object is no longer valid.</p>
<p>The scaling factor is specified on decompresson. It descales the size of the JPEG image by 1/2, 1/4 or 1/8. e.g. when decompress a JPEG image of 1024x768 in 1/4 scaling, it will be output in 256x192. The scaling ratio of 1/2 and 1/4 will slightly decrease the decompression speed compared to non scaling due to averaging process. But scaling ratio of 1/8 will 2-3 times faster than non scaling output because IDCT and averaging for each block can be skipped. This characteristic is sutable to create thumbnails.</p>
</div>


<p class="foot"><a href="../00index.html">Return</a></p>
</body>
</html>
